package utils;

import org.json.JSONObject;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * Created by USER on 2016/7/7.
 */
public class JsonUtil {

    public static String toJsonString(JSONObject jsonObject){

        String result="{";

        Iterator iterator = jsonObject.keys();
        while(iterator.hasNext()){
           String key = (String) iterator.next();
           String value = jsonObject.optString(key);

            result+="\\\""+key+"\\\":\\\""+value+"\\\",";
        }
        if (result.endsWith(",")){
            result=result.substring(0,result.length()-1);
        }

        return  result+"}";
    }

}
